﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace Demo16_1_2
{
    internal class Program
    {
      //  [DllImport("Demo16-1-3.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]//正确
        [DllImport("Demo16-1-3.dll",CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Unicode)]//错误
        public extern static void Alloc(string str);
        static void Main(string[] args)
        {
            var str = "Hello World";
            Alloc(str);
            Console.ReadLine();
        }
    }
}
